export const getTime = (time, type = 'date', reg="-") => {
	let temptime = time ? parseInt(time, 10) : null
	let result = '---'
	if (temptime) {
		let tdate = new Date(temptime * 1000)
		let year = tdate.getFullYear()
		let month = (tdate.getMonth() + 1) > 9 ? (tdate.getMonth() + 1) : '0' + (tdate.getMonth() + 1)
		let date = (tdate.getDate()) > 9 ? (tdate.getDate()) : '0' + (tdate.getDate())
		let hour = (tdate.getHours()) > 9 ? (tdate.getHours()) : '0' + (tdate.getHours())
		let minute = (tdate.getMinutes()) > 9 ? (tdate.getMinutes()) : '0' + (tdate.getMinutes())
		let second = (tdate.getSeconds()) > 9 ? (tdate.getSeconds())  : '0' + (tdate.getSeconds())
		result = [year, month, date].join(reg)
		if (type == 'time') {
			result += ' ' + [hour, minute, second].join(':')
		}
		if (type == 'min') {
			result += ' ' + [hour, minute, second].join(':')
		}
	}
	return result
}